


<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
        <link rel="canonical" href="https://daptin.github.io/daptin/apis/crud/">
      
      
      <link rel="shortcut icon" href="../../images/theme-favicon.png">
      <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.5.3">
    
    
      
        <title>API reference - Daptin</title>
      
    
    
      <link rel="stylesheet" href="../../assets/stylesheets/main.947af8d5.min.css">
      
      
    
    
    
      
        <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
        <style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace}</style>
      
    
    
    
      <link rel="stylesheet" href="../../css/theme_extra.css">
    
    
      
        
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-114227400-1","docs.dapt.in"),ga("set","anonymizeIp",!0),ga("send","pageview"),document.addEventListener("DOMContentLoaded",function(){document.forms.search&&document.forms.search.query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})}),document.addEventListener("DOMContentSwitch",function(){ga("send","pageview",document.location.pathname)})</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
      
    
    
  </head>
  
  
    <body dir="ltr">
  
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#api-reference" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
      <header class="md-header" data-md-component="header">
  <nav class="md-header-nav md-grid" aria-label="Header">
    <a href="https://daptin.github.io/daptin/" title="Daptin" class="md-header-nav__button md-logo" aria-label="Daptin">
      
  <img src="../../images/theme-logo.png" alt="logo">

    </a>
    <label class="md-header-nav__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
    </label>
    <div class="md-header-nav__title" data-md-component="header-title">
      
        <div class="md-header-nav__ellipsis">
          <span class="md-header-nav__topic md-ellipsis">
            Daptin
          </span>
          <span class="md-header-nav__topic md-ellipsis">
            
              API reference
            
          </span>
        </div>
      
    </div>
    
      <label class="md-header-nav__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
      </label>
      
<div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </label>
      <button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
      </button>
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
  </nav>
</header>
    
    <div class="md-container" data-md-component="container">
      
        
      
      
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="https://daptin.github.io/daptin/" title="Daptin" class="md-nav__button md-logo" aria-label="Daptin">
      
  <img src="../../images/theme-logo.png" alt="logo">

    </a>
    Daptin
  </label>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-1" type="checkbox" id="nav-1">
    
    <label class="md-nav__link" for="nav-1">
      Getting started
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="Getting started" data-md-level="1">
      <label class="md-nav__title" for="nav-1">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        Getting started
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../.." title="Daptin" class="md-nav__link">
      Daptin
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../setting-up/installation/" title="Installation" class="md-nav__link">
      Installation
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../setting-up/settingup/" title="Getting started" class="md-nav__link">
      Getting started
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../setting-up/access/" title="User management" class="md-nav__link">
      User management
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../setting-up/data_modeling/" title="Data model" class="md-nav__link">
      Data model
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2">
    
    <label class="md-nav__link" for="nav-2">
      JSON API reference
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="JSON API reference" data-md-level="1">
      <label class="md-nav__title" for="nav-2">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        JSON API reference
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="#crud-api" title="CRUD API" class="md-nav__link">
      CRUD API
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="#action-api" title="Action API" class="md-nav__link">
      Action API
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="#relation-apis" title="Relation API" class="md-nav__link">
      Relation API
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="#aggregate-api" title="Aggregation API" class="md-nav__link">
      Aggregation API
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="#state-machine-apis" title="State machine API" class="md-nav__link">
      State machine API
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="#metadata-api" title="Metadata API" class="md-nav__link">
      Metadata API
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
    
    <label class="md-nav__link" for="nav-3">
      Actions
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="Actions" data-md-level="1">
      <label class="md-nav__title" for="nav-3">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        Actions
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../actions/actions/" title="What are actions" class="md-nav__link">
      What are actions
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../actions/default_actions/" title="Actions list" class="md-nav__link">
      Actions list
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../actions/examples/" title="Examples" class="md-nav__link">
      Examples
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
    
    <label class="md-nav__link" for="nav-4">
      Features
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="Features" data-md-level="1">
      <label class="md-nav__title" for="nav-4">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        Features
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../features/enable-graphql/" title="GraphQL" class="md-nav__link">
      GraphQL
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../features/enable-data-auditing/" title="Data Auditing" class="md-nav__link">
      Data Auditing
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../features/enable-multilingual-table/" title="Multilingual Table" class="md-nav__link">
      Multilingual Table
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../features/enable-smtp-imap/" title="SMTP/IMPS server" class="md-nav__link">
      SMTP/IMPS server
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../features/enable-logs/" title="Logs" class="md-nav__link">
      Logs
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../state/machines/" title="State tracking" class="md-nav__link">
      State tracking
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../extend/oauth_connection/" title="OAuth Connections" class="md-nav__link">
      OAuth Connections
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../extend/oauth_token/" title="OAuth Tokens" class="md-nav__link">
      OAuth Tokens
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../integrations/overview/" title="Integrations Overview" class="md-nav__link">
      Integrations Overview
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../cloudstore/cloudstore/" title="Cloud store" class="md-nav__link">
      Cloud store
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../cloudstore/assetcolumns/" title="Cloud store backed asset columns" class="md-nav__link">
      Cloud store backed asset columns
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-4-12" type="checkbox" id="nav-4-12">
    
    <label class="md-nav__link" for="nav-4-12">
      Sub-sites
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="Sub-sites" data-md-level="2">
      <label class="md-nav__title" for="nav-4-12">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        Sub-sites
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../subsite/subsite/" title="Creating a subsite" class="md-nav__link">
      Creating a subsite
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../subsite/grapes/" title="Live editing a subsite" class="md-nav__link">
      Live editing a subsite
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../subsite/basic_auth/" title="Basic Authentication" class="md-nav__link">
      Basic Authentication
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
    
    <label class="md-nav__link" for="nav-5">
      Reference Documents
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="Reference Documents" data-md-level="1">
      <label class="md-nav__title" for="nav-5">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        Reference Documents
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../data-modeling/data_storage/" title="Data store format" class="md-nav__link">
      Data store format
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../extend/data_exchange/" title="Data exchange and sync" class="md-nav__link">
      Data exchange and sync
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../streams/streams/" title="Data streams" class="md-nav__link">
      Data streams
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../setting-up/enabling-features/" title="Enable/Disabling features" class="md-nav__link">
      Enable/Disabling features
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
    
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#api-overview" class="md-nav__link">
    API Overview
  </a>
  
    <nav class="md-nav" aria-label="API Overview">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#crud-api" class="md-nav__link">
    CRUD API
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#action-api" class="md-nav__link">
    Action API
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#relation-apis" class="md-nav__link">
    Relation APIs
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#aggregate-api" class="md-nav__link">
    Aggregate API
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#state-machine-apis" class="md-nav__link">
    State machine APIs
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#websocket-api-wip" class="md-nav__link">
    Websocket API (wip)
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#metadata-api" class="md-nav__link">
    Metadata API
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#read" class="md-nav__link">
    Read
  </a>
  
    <nav class="md-nav" aria-label="Read">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#query-parameters" class="md-nav__link">
    Query Parameters
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#response" class="md-nav__link">
    Response
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#examples" class="md-nav__link">
    Examples
  </a>
  
    <nav class="md-nav" aria-label="Examples">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#curl-example" class="md-nav__link">
    Curl example
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#jquery-ajax-example" class="md-nav__link">
    jQuery ajax example
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#node-js-example" class="md-nav__link">
    Node js example
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#python-example" class="md-nav__link">
    Python example
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#php-example" class="md-nav__link">
    PHP example
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#filtering" class="md-nav__link">
    Filtering
  </a>
  
    <nav class="md-nav" aria-label="Filtering">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#example" class="md-nav__link">
    Example
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#create" class="md-nav__link">
    Create
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#update" class="md-nav__link">
    Update
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#delete" class="md-nav__link">
    Delete
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#execute" class="md-nav__link">
    Execute
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#relations" class="md-nav__link">
    Relations
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          <div class="md-content">
            <article class="md-content__inner md-typeset">
              
                
                
                  
                
                
                <h1 id="api-reference">API reference<a class="headerlink" href="#api-reference" title="Permanent link">Link</a></h1>
<p>Daptin exposes various endpoints for each entity defined in the schema:</p>
<ul>
<li>Create</li>
<li>Find one</li>
<li>Update</li>
<li>Delete</li>
<li>Find all</li>
<li>Find relations</li>
<li>Execute action</li>
<li>Aggregate</li>
<li>State management</li>
</ul>
<p>All endpoints allow authentication using the Authorization Header.</p>
<h2 id="api-overview">API Overview<a class="headerlink" href="#api-overview" title="Permanent link">Link</a></h2>
<h3 id="crud-api">CRUD API<a class="headerlink" href="#crud-api" title="Permanent link">Link</a></h3>
<p>Read/Create/Update/Delete</p>
<table>
<thead>
<tr>
<th>GET</th>
<th>/api/{entityName}</th>
<th>Query Params</th>
<th>Request Body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>/api/{entityName}</td>
<td>page[size]= page[number] query filter</td>
<td></td>
<td><a href="#read">Detailed documentation</a></td>
</tr>
<tr>
<td>POST</td>
<td>/api/{entityName}</td>
<td></td>
<td></td>
<td>Find all rows, paginated with query and filters <a href="#create">Example</a></td>
</tr>
<tr>
<td>PATCH</td>
<td>/api/{entityName}/{id}</td>
<td></td>
<td>{"attributes": { ...{fields} } "type": "{entityType} }</td>
<td>Update row by reference id <a href="#update">Example</a></td>
</tr>
<tr>
<td>PUT</td>
<td>/api/{entityName}/{id}</td>
<td></td>
<td>{"attributes": { } "type": "{entityType} }</td>
<td>Update row by reference id  <a href="#update">Example</a></td>
</tr>
<tr>
<td>DELETE</td>
<td>/api/{entityName}/{id}</td>
<td></td>
<td></td>
<td>Delete a row  <a href="#delete">Example</a></td>
</tr>
</tbody>
</table>
<h3 id="action-api">Action API<a class="headerlink" href="#action-api" title="Permanent link">Link</a></h3>
<table>
<thead>
<tr>
<th>GET</th>
<th>/action/{entityName}/{actionName}</th>
<th>Query Params</th>
<th>Request Body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>POST</td>
<td>/api/{entityName}/</td>
<td>action parameters</td>
<td>Action Parameters</td>
<td>Execute action</td>
</tr>
</tbody>
</table>
<h3 id="relation-apis">Relation APIs<a class="headerlink" href="#relation-apis" title="Permanent link">Link</a></h3>
<table>
<thead>
<tr>
<th>Method</th>
<th>Path</th>
<th>Query params</th>
<th>Request body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>/api/{entityName}/{id}/{relationName}</td>
<td>page[size]= page[number] query filter</td>
<td></td>
<td>Find all related rows by relation name, eg, "posts" of a user</td>
</tr>
<tr>
<td>DELETE</td>
<td>/api/{entityName}/{id}/{relationName}</td>
<td></td>
<td>{"id": , "type":  }</td>
<td>Delete a related row, eg: delete post of a user. this only removes a relation and not the actual row.</td>
</tr>
<tr>
<td>GET</td>
<td>/action/{entityName}/{actionName}</td>
<td>Parameters for action</td>
<td></td>
<td>Invoke an action on an entity</td>
</tr>
<tr>
<td>POST</td>
<td>/action/{entityName}/{actionName}</td>
<td></td>
<td>{ "attribute": { Parameters for action }, "id": "&lt; object id &gt;" type: "&lt; entity type &gt;" }</td>
<td>Invoke an action on an entity</td>
</tr>
</tbody>
</table>
<h3 id="aggregate-api">Aggregate API<a class="headerlink" href="#aggregate-api" title="Permanent link">Link</a></h3>
<table>
<thead>
<tr>
<th>Method</th>
<th>Path</th>
<th>Query params</th>
<th>Request body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>/stats/{typeName}</td>
<td>group/filter/join/column/timestamp/timefrom/timeto/order</td>
<td></td>
<td>Run aggregate function over entity table</td>
</tr>
</tbody>
</table>
<h3 id="state-machine-apis">State machine APIs<a class="headerlink" href="#state-machine-apis" title="Permanent link">Link</a></h3>
<p>Enabled for the entities for which you have enabled state machines</p>
<table>
<thead>
<tr>
<th>Method</th>
<th>Path</th>
<th>Query params</th>
<th>Request body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>POST</td>
<td>/track/start/{stateMachineId}</td>
<td></td>
<td>{ "id": " &lt; reference id &gt;", type: " &lt; entity type &gt; " }</td>
<td>Start tracking according to the state machine for an object</td>
</tr>
<tr>
<td>POST</td>
<td>/track/event/{typename}/{objectStateId}/{eventName}</td>
<td></td>
<td></td>
<td>Invoke an event on a particular track of the state machine for a object</td>
</tr>
</tbody>
</table>
<h3 id="websocket-api-wip">Websocket API (wip)<a class="headerlink" href="#websocket-api-wip" title="Permanent link">Link</a></h3>
<p>Listed to incoming updates to data over websocket live</p>
<table>
<thead>
<tr>
<th>Method</th>
<th>Path</th>
<th>Query params</th>
<th>Request body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>/live</td>
<td></td>
<td></td>
<td>Initiate a web socket connection</td>
</tr>
</tbody>
</table>
<h3 id="metadata-api">Metadata API<a class="headerlink" href="#metadata-api" title="Permanent link">Link</a></h3>
<p>Meatadata APIs expose information about the daptin server itself</p>
<table>
<thead>
<tr>
<th>Method</th>
<th>Path</th>
<th>Query params</th>
<th>Request body</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>/apispec.raml</td>
<td></td>
<td></td>
<td>RAML Spec for all API's  exposed by the current instance</td>
</tr>
<tr>
<td>GET</td>
<td>/ping</td>
<td></td>
<td></td>
<td>Replies with PONG, Endpoint for liveness probe</td>
</tr>
<tr>
<td>GET</td>
<td>/statistics</td>
<td></td>
<td></td>
<td>Replies with PONG, Endpoint for healht check probe</td>
</tr>
</tbody>
</table>
<h2 id="read">Read<a class="headerlink" href="#read" title="Permanent link">Link</a></h2>
<h3 id="query-parameters">Query Parameters<a class="headerlink" href="#query-parameters" title="Permanent link">Link</a></h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>parameter type</th>
<th>default value</th>
<th>example value</th>
</tr>
</thead>
<tbody>
<tr>
<td>page[number]</td>
<td>integer</td>
<td>1</td>
<td>5</td>
</tr>
<tr>
<td>page[size]</td>
<td>integer</td>
<td>10</td>
<td>100</td>
</tr>
<tr>
<td>query</td>
<td>json base64</td>
<td>[]</td>
<td>[{"column": "name", "operator": "is", "value": "england"}]</td>
</tr>
<tr>
<td>group</td>
<td>string</td>
<td>-</td>
<td>[{"column": "name", "order": "desc"}]</td>
</tr>
<tr>
<td>included_relations</td>
<td>comma separated string</td>
<td>-</td>
<td>user post author</td>
</tr>
<tr>
<td>sort</td>
<td>comma seaparated string</td>
<td>-</td>
<td>created_at amount guest_count</td>
</tr>
<tr>
<td>filter</td>
<td>string</td>
<td>-</td>
<td>england</td>
</tr>
</tbody>
</table>
<h3 id="response">Response<a class="headerlink" href="#response" title="Permanent link">Link</a></h3>
<div class="admonition example">
<p class="admonition-title">Response example</p>
<div class="highlight"><pre><span></span><code><span class="p">{</span>
    <span class="nt">&quot;links&quot;</span><span class="p">:</span> <span class="p">{</span>
        <span class="nt">&quot;current_page&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="nt">&quot;from&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="nt">&quot;last_page&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="nt">&quot;per_page&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
        <span class="nt">&quot;to&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
        <span class="nt">&quot;total&quot;</span><span class="p">:</span> <span class="mi">1</span>
    <span class="p">},</span>
    <span class="nt">&quot;data&quot;</span><span class="p">:</span> <span class="p">[{</span>
        <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;book&quot;</span><span class="p">,</span>
        <span class="nt">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;29d11cb3-3fad-4972-bf3b-9cfc6da9e6a6&quot;</span><span class="p">,</span>
        <span class="nt">&quot;attributes&quot;</span><span class="p">:</span> <span class="p">{</span>
            <span class="nt">&quot;__type&quot;</span><span class="p">:</span> <span class="s2">&quot;book&quot;</span><span class="p">,</span>
            <span class="nt">&quot;confirmed&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
            <span class="nt">&quot;created_at&quot;</span><span class="p">:</span> <span class="s2">&quot;2018-04-05 15:47:29&quot;</span><span class="p">,</span>
            <span class="nt">&quot;title&quot;</span><span class="p">:</span> <span class="s2">&quot;book title&quot;</span><span class="p">,</span>
            <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;book name&quot;</span><span class="p">,</span>
            <span class="nt">&quot;permission&quot;</span><span class="p">:</span> <span class="mi">127127127</span><span class="p">,</span>
            <span class="nt">&quot;reference_id&quot;</span><span class="p">:</span> <span class="s2">&quot;29d11cb3-3fad-4972-bf3b-9cfc6da9e6a6&quot;</span><span class="p">,</span>
            <span class="nt">&quot;updated_at&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
            <span class="nt">&quot;user_id&quot;</span><span class="p">:</span> <span class="s2">&quot;696c98d3-3b8b-41da-a510-08e6948cf661&quot;</span>
        <span class="p">},</span>
        <span class="nt">&quot;relationships&quot;</span><span class="p">:</span> <span class="p">{</span>
            <span class="nt">&quot;author_id&quot;</span><span class="p">:</span> <span class="p">{</span>
                <span class="nt">&quot;links&quot;</span><span class="p">:</span> <span class="p">{</span>
                    <span class="nt">&quot;related&quot;</span><span class="p">:</span> <span class="s2">&quot;/api/book/&lt;book-id/author_id&quot;</span><span class="p">,</span>
                    <span class="nt">&quot;self&quot;</span><span class="p">:</span> <span class="s2">&quot;/api/book/&lt;book-id&gt;/relationships/author_id&quot;</span>
                <span class="p">},</span>
                <span class="nt">&quot;data&quot;</span><span class="p">:</span> <span class="p">[]</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">}]</span>
<span class="p">}</span>
</code></pre></div>

</div>
<h3 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">Link</a></h3>
<h4 id="curl-example">Curl example<a class="headerlink" href="#curl-example" title="Permanent link">Link</a></h4>
<div class="codehilite"><pre><span></span><code><span class="n">curl</span><span class="w"> </span><span class="s1">&#39;/api/&lt;entityName&gt;?sort=&amp;page[number]=1&amp;page[size]=10&#39;</span><span class="w"> </span><span class="err">\</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span><span class="n">H</span><span class="w"> </span><span class="s1">&#39;Authorization: Bearer &lt;AccessToken&gt;&#39;</span><span class="w"></span>
</code></pre></div>


<h4 id="jquery-ajax-example">jQuery ajax example<a class="headerlink" href="#jquery-ajax-example" title="Permanent link">Link</a></h4>
<div class="codehilite"><pre><span></span><code><span class="err">$</span><span class="p">.</span><span class="n">ajax</span><span class="p">(</span><span class="err">{</span><span class="w"></span>
<span class="w">    </span><span class="k">method</span><span class="err">:</span><span class="w"> </span><span class="ss">&quot;GET&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="nl">url</span><span class="p">:</span><span class="w"> </span><span class="s1">&#39;/api/&lt;entityName&gt;?sort=&amp;page[number]=1&amp;page[size]=10&#39;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="nl">success</span><span class="p">:</span><span class="w"> </span><span class="k">function</span><span class="p">(</span><span class="n">response</span><span class="p">)</span><span class="err">{</span><span class="w"></span>
<span class="w">        </span><span class="n">console</span><span class="p">.</span><span class="nf">log</span><span class="p">(</span><span class="n">response</span><span class="p">.</span><span class="k">data</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="err">}</span><span class="w"></span>
<span class="w">  </span><span class="err">}</span><span class="p">)</span><span class="w"></span>
</code></pre></div>


<h4 id="node-js-example">Node js example<a class="headerlink" href="#node-js-example" title="Permanent link">Link</a></h4>
<div class="codehilite"><pre><span></span><code><span class="nf">var</span><span class="w"> </span><span class="n">request</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">require</span><span class="p">(</span><span class="s1">&#39;request&#39;</span><span class="p">);</span><span class="w"></span>

<span class="nf">var</span><span class="w"> </span><span class="n">headers</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="err">{</span><span class="w"></span>
<span class="w">    </span><span class="s1">&#39;Authorization&#39;</span><span class="err">:</span><span class="w"> </span><span class="s1">&#39;Bearer &lt;AccessToken&gt;&#39;</span><span class="w"></span>
<span class="err">}</span><span class="p">;</span><span class="w"></span>

<span class="nf">var</span><span class="w"> </span><span class="n">options</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="err">{</span><span class="w"></span>
<span class="w">    </span><span class="nl">url</span><span class="p">:</span><span class="w"> </span><span class="s1">&#39;/api/&lt;entityName&gt;?sort=&amp;page[number]=1&amp;page[size]=10&#39;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="nl">headers</span><span class="p">:</span><span class="w"> </span><span class="n">headers</span><span class="w"></span>
<span class="err">}</span><span class="p">;</span><span class="w"></span>

<span class="k">function</span><span class="w"> </span><span class="n">callback</span><span class="p">(</span><span class="n">error</span><span class="p">,</span><span class="w"> </span><span class="n">response</span><span class="p">,</span><span class="w"> </span><span class="n">body</span><span class="p">)</span><span class="w"> </span><span class="err">{</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="err">!</span><span class="n">error</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="n">response</span><span class="p">.</span><span class="n">statusCode</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">200</span><span class="p">)</span><span class="w"> </span><span class="err">{</span><span class="w"></span>
<span class="w">        </span><span class="n">console</span><span class="p">.</span><span class="nf">log</span><span class="p">(</span><span class="n">body</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="err">}</span><span class="w"></span>
<span class="err">}</span><span class="w"></span>

<span class="n">request</span><span class="p">(</span><span class="n">options</span><span class="p">,</span><span class="w"> </span><span class="n">callback</span><span class="p">);</span><span class="w"></span>
</code></pre></div>


<h4 id="python-example">Python example<a class="headerlink" href="#python-example" title="Permanent link">Link</a></h4>
<div class="codehilite"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;AccessToken&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">params</span> <span class="o">=</span> <span class="p">(</span>
    <span class="p">(</span><span class="s1">&#39;sort&#39;</span><span class="p">,</span> <span class="s1">&#39;-created_at&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;page[number]&#39;</span><span class="p">,</span> <span class="s1">&#39;1&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;page[size]&#39;</span><span class="p">,</span> <span class="s1">&#39;10&#39;</span><span class="p">),</span>
<span class="p">)</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;http://localhost:6336/api/laptop&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">)</span>
</code></pre></div>


<h4 id="php-example">PHP example<a class="headerlink" href="#php-example" title="Permanent link">Link</a></h4>
<div class="codehilite"><pre><span></span><code><span class="o">&lt;</span><span class="vm">?</span><span class="n">php</span><span class="w"></span>
<span class="k">include</span><span class="p">(</span><span class="s1">&#39;vendor/rmccue/requests/library/Requests.php&#39;</span><span class="p">);</span><span class="w"></span>
<span class="nl">Requests</span><span class="p">:</span><span class="err">:</span><span class="n">register_autoloader</span><span class="p">();</span><span class="w"></span>
<span class="err">$</span><span class="n">headers</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">array</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="s1">&#39;Authorization&#39;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="s1">&#39;Bearer &lt;AccessToken&gt;&#39;</span><span class="w"></span>
<span class="p">);</span><span class="w"></span>
<span class="err">$</span><span class="n">response</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nl">Requests</span><span class="p">:</span><span class="err">:</span><span class="k">get</span><span class="p">(</span><span class="s1">&#39;http://localhost:6336/api/laptop?sort=&amp;page[number]=1&amp;page[size]=10&#39;</span><span class="p">,</span><span class="w"> </span><span class="err">$</span><span class="n">headers</span><span class="p">);</span><span class="w"></span>
</code></pre></div>


<h3 id="filtering">Filtering<a class="headerlink" href="#filtering" title="Permanent link">Link</a></h3>
<p>Used to search items in a table that matche the filter's conditions. Filters follow the syntax <code>query=[{"column": "&lt;column_name&gt;", "operator": "&lt;compare-operator&gt;", "value":"&lt;value&gt;"}]</code></p>
<table>
<thead>
<tr>
<th>Daptin operator</th>
<th>SQL compare operator</th>
</tr>
</thead>
<tbody>
<tr>
<td>contains</td>
<td>like  '%\<value>'</td>
</tr>
<tr>
<td>not contains</td>
<td>not like  '%\<value>'</td>
</tr>
<tr>
<td>is</td>
<td>=</td>
</tr>
<tr>
<td>is not</td>
<td>!=</td>
</tr>
<tr>
<td>before</td>
<td>&lt;</td>
</tr>
<tr>
<td>less then</td>
<td>&lt;</td>
</tr>
<tr>
<td>after</td>
<td>&gt;</td>
</tr>
<tr>
<td>more then</td>
<td>&gt;</td>
</tr>
<tr>
<td>any of</td>
<td>in</td>
</tr>
<tr>
<td>none of</td>
<td>not in</td>
</tr>
<tr>
<td>is empty</td>
<td>is null</td>
</tr>
<tr>
<td>is not empty</td>
<td>is not null</td>
</tr>
</tbody>
</table>
<h4 id="example">Example<a class="headerlink" href="#example" title="Permanent link">Link</a></h4>
<div class="codehilite"><pre><span></span><code><span class="err">curl &#39;/api/world?query=[{&quot;column&quot;: &quot;is_hidden&quot;, &quot;operator&quot;: &quot;any of&quot;, &quot;value&quot;:&quot;1,0&quot;}] \</span>
<span class="err">  -H &#39;Authorization: Bearer &lt;AccessToken&gt;&#39;</span>
</code></pre></div>


<h2 id="create">Create<a class="headerlink" href="#create" title="Permanent link">Link</a></h2>
<div class="admonition example">
<p class="admonition-title">Curl Example</p>
<div class="highlight"><pre><span></span><code>curl &#39;/api/&lt;EntityName&gt;&#39;
    -H &#39;Authorization: Bearer &lt;Token&gt;&#39;
    --data-binary &#39;{
                &quot;data&quot;: {
                    &quot;type&quot;: &quot;&lt;EntityName&gt;&quot;,
                    &quot;attributes&quot;: {
                        &quot;name&quot;: &quot;name&quot;
                    }
                }
           }&#39;
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Nodejs example</p>
<div class="highlight"><pre><span></span><code>var request = require(&#39;request&#39;);

var headers = {
    &#39;Authorization&#39;: &#39;Bearer &lt;Token&gt;&#39;,
};

var dataString = &#39;{
                    &quot;data&quot;: {
                        &quot;type&quot;: &quot;&lt;EntityName&gt;&quot;,
                        &quot;attributes&quot;: {
                            &quot;name&quot;: &quot;name&quot;
                        }
                    }
                  }&#39;;

var options = {
    url: &#39;/api/&lt;EntityName&gt;&#39;,
    method: &#39;POST&#39;,
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Python example</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;{</span>
            <span class="s2">&quot;data&quot;</span><span class="p">:</span> <span class="p">{</span>
                <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;&lt;EntityName&gt;&quot;</span><span class="p">,</span>
                <span class="s2">&quot;attributes&quot;</span><span class="p">:</span> <span class="p">{</span>
                    <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;name&quot;</span>
                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span><span class="s1">&#39;</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s1">&#39;/api/&lt;EntityName&gt;&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">PHP Example</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?php</span>
<span class="k">include</span><span class="p">(</span><span class="s1">&#39;vendor/rmccue/requests/library/Requests.php&#39;</span><span class="p">);</span>
<span class="nx">Requests</span><span class="o">::</span><span class="na">register_autoloader</span><span class="p">();</span>
<span class="nv">$headers</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;Authorization&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">);</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">&#39;{</span>
<span class="s1">            &quot;data&quot;: {</span>
<span class="s1">                &quot;type&quot;: &quot;&lt;EntityName&gt;&quot;,</span>
<span class="s1">                &quot;attributes&quot;: {</span>
<span class="s1">                    &quot;name&quot;: &quot;name&quot;</span>
<span class="s1">                }</span>
<span class="s1">            }</span>
<span class="s1">         }&#39;</span><span class="p">;</span>
<span class="nv">$response</span> <span class="o">=</span> <span class="nx">Requests</span><span class="o">::</span><span class="na">post</span><span class="p">(</span><span class="s1">&#39;/api/&lt;EntityName&gt;&#39;</span><span class="p">,</span> <span class="nv">$headers</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
</code></pre></div>

</div>
<h2 id="update">Update<a class="headerlink" href="#update" title="Permanent link">Link</a></h2>
<div class="admonition example">
<p class="admonition-title">Curl example</p>
<div class="highlight"><pre><span></span><code>curl &#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;&#39; \
-X PATCH \
-H &#39;Authorization: Bearer &lt;Token&gt;&#39; \
--data-binary &#39;{
                &quot;data&quot;: {
                    &quot;type&quot;: &quot;&lt;EntityName&gt;&quot;,
                    &quot;attributes&quot;: {
                        &quot;confirmed&quot;: false,
                        &quot;email&quot;: &quot;update@gmail.com&quot;,
                        &quot;name&quot;: &quot;new name&quot;,
                        &quot;password&quot;: &quot;&quot;
                    },
                    &quot;id&quot;: &quot;&lt;ReferenceId&gt;&quot;
                }
              }&#39;
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Nodejs example</p>
<div class="highlight"><pre><span></span><code>var request = require(&#39;request&#39;);

var headers = {
    &#39;Authorization&#39;: &#39;Bearer &lt;Token&gt;&#39;
};

var dataString = &#39;{
                  &quot;data&quot;: {
                      &quot;type&quot;: &quot;&lt;EntityName&gt;&quot;,
                      &quot;attributes&quot;: {
                          &quot;confirmed&quot;: false,
                          &quot;email&quot;: &quot;update@gmail.com&quot;,
                          &quot;name&quot;: &quot;new name&quot;,
                          &quot;password&quot;: &quot;&quot;,
                          &quot;permission&quot;: 127127127,
                      },
                      &quot;relationships&quot;: {
                          &quot;relation_name&quot;: [ ... ]
                      },
                      &quot;id&quot;: &quot;&lt;ReferenceId&gt;&quot;
                  }
                }&#39;;

var options = {
    url: &#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;&#39;,
    method: &#39;PATCH&#39;,
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
        console.log(body);
    }
}


request(options, callback);
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Python example</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;{</span>
          <span class="s2">&quot;data&quot;</span><span class="p">:</span> <span class="p">{</span>
              <span class="s2">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;&lt;EntityName&gt;&quot;</span><span class="p">,</span>
              <span class="s2">&quot;attributes&quot;</span><span class="p">:</span> <span class="p">{</span>
                  <span class="s2">&quot;confirmed&quot;</span><span class="p">:</span> <span class="n">false</span><span class="p">,</span>
                  <span class="s2">&quot;email&quot;</span><span class="p">:</span> <span class="s2">&quot;update@gmail.com&quot;</span><span class="p">,</span>
                  <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;new name&quot;</span><span class="p">,</span>
                  <span class="s2">&quot;password&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
                  <span class="s2">&quot;permission&quot;</span><span class="p">:</span> <span class="mi">127127127</span><span class="p">,</span>
              <span class="p">},</span>
              <span class="s2">&quot;relationships&quot;</span><span class="p">:</span> <span class="p">{</span>
                  <span class="s2">&quot;relation_name&quot;</span><span class="p">:</span> <span class="p">[</span> <span class="o">...</span> <span class="p">]</span>
              <span class="p">},</span>
              <span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;&lt;ReferenceId&gt;&quot;</span>
          <span class="p">}</span>
        <span class="p">}</span><span class="s1">&#39;</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">patch</span><span class="p">(</span><span class="s1">&#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">PHP example</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?php</span>
<span class="k">include</span><span class="p">(</span><span class="s1">&#39;vendor/rmccue/requests/library/Requests.php&#39;</span><span class="p">);</span>
<span class="nx">Requests</span><span class="o">::</span><span class="na">register_autoloader</span><span class="p">();</span>
<span class="nv">$headers</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;Authorization&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span>
<span class="p">);</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">&#39;{</span>
<span class="s1">           &quot;data&quot;: {</span>
<span class="s1">               &quot;type&quot;: &quot;&lt;EntityName&gt;&quot;,</span>
<span class="s1">               &quot;attributes&quot;: {</span>
<span class="s1">                   &quot;confirmed&quot;: false,</span>
<span class="s1">                   &quot;email&quot;: &quot;update@gmail.com&quot;,</span>
<span class="s1">                   &quot;name&quot;: &quot;new name&quot;,</span>
<span class="s1">                   &quot;password&quot;: &quot;&quot;,</span>
<span class="s1">                   &quot;permission&quot;: 127127127,</span>
<span class="s1">               },</span>
<span class="s1">               &quot;relationships&quot;: {</span>
<span class="s1">                   &quot;relation_name&quot;: [ ... ]</span>
<span class="s1">               },</span>
<span class="s1">               &quot;id&quot;: &quot;&lt;ReferenceId&gt;&quot;</span>
<span class="s1">           }</span>
<span class="s1">         }&#39;</span><span class="p">;</span>
<span class="nv">$response</span> <span class="o">=</span> <span class="nx">Requests</span><span class="o">::</span><span class="na">patch</span><span class="p">(</span><span class="s1">&#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;&#39;</span><span class="p">,</span> <span class="nv">$headers</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
</code></pre></div>

</div>
<h2 id="delete">Delete<a class="headerlink" href="#delete" title="Permanent link">Link</a></h2>
<p>Delete a row from a table</p>
<div class="admonition example">
<p class="admonition-title">Curl example</p>
<div class="highlight"><pre><span></span><code>curl <span class="s1">&#39;/api/user_account/a5b9add2-ea56-4717-a785-7dee71a2ae46&#39;</span> -X DELETE  -H <span class="s1">&#39;Authorization: Bearer &lt;Token&gt;&#39;</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Nodejs example</p>
<div class="highlight"><pre><span></span><code>var request = require(&#39;request&#39;);

var headers = {
    &#39;Authorization&#39;: &#39;Bearer &lt;Token&gt;&#39;
};

var options = {
    url: &#39;/api/user_account/a5b9add2-ea56-4717-a785-7dee71a2ae46&#39;,
    method: &#39;DELETE&#39;,
    headers: headers
};

function callback(error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Python example</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="s1">&#39;/api/user_account/a5b9add2-ea56-4717-a785-7dee71a2ae46&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">)</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">PHP example</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?php</span>
<span class="k">include</span><span class="p">(</span><span class="s1">&#39;vendor/rmccue/requests/library/Requests.php&#39;</span><span class="p">);</span>
<span class="nx">Requests</span><span class="o">::</span><span class="na">register_autoloader</span><span class="p">();</span>
<span class="nv">$headers</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;Authorization&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span>
<span class="p">);</span>
<span class="nv">$response</span> <span class="o">=</span> <span class="nx">Requests</span><span class="o">::</span><span class="na">delete</span><span class="p">(</span><span class="s1">&#39;/api/user_account/a5b9add2-ea56-4717-a785-7dee71a2ae46&#39;</span><span class="p">,</span> <span class="nv">$headers</span><span class="p">);</span>
</code></pre></div>

</div>
<h2 id="execute">Execute<a class="headerlink" href="#execute" title="Permanent link">Link</a></h2>
<p>Execute an action on an entity type or instance</p>
<div class="admonition example">
<p class="admonition-title">Curl example</p>
<div class="highlight"><pre><span></span><code>curl &#39;/action/&lt;EntityName&gt;/&lt;ActionName&gt;&#39;  -H &#39;Authorization: Bearer &lt;Token&gt;&#39;  --data-binary &#39;{&quot;attributes&quot;:{}}&#39;
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">PHP Example</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?php</span>
<span class="k">include</span><span class="p">(</span><span class="s1">&#39;vendor/rmccue/requests/library/Requests.php&#39;</span><span class="p">);</span>
<span class="nx">Requests</span><span class="o">::</span><span class="na">register_autoloader</span><span class="p">();</span>
<span class="nv">$headers</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;Authorization&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span>
<span class="p">);</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">&#39;{&quot;attributes&quot;:{}}&#39;</span><span class="p">;</span>
<span class="nv">$response</span> <span class="o">=</span> <span class="nx">Requests</span><span class="o">::</span><span class="na">post</span><span class="p">(</span><span class="s1">&#39;/action/&lt;EntityName&gt;/&lt;ActionName&gt;&#39;</span><span class="p">,</span> <span class="nv">$headers</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Nodejs example</p>
<div class="highlight"><pre><span></span><code>var request = require(&#39;request&#39;);

var headers = {
    &#39;Authorization&#39;: &#39;Bearer &lt;Token&gt;&#39;
};

var dataString = &#39;{&quot;attributes&quot;:{}}&#39;;

var options = {
    url: &#39;/action/&lt;EntityName&gt;/&lt;ActionName&gt;&#39;,
    method: &#39;POST&#39;,
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">Python example</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">data</span> <span class="o">=</span> <span class="s1">&#39;{&quot;attributes&quot;:</span><span class="si">{}</span><span class="s1">}&#39;</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s1">&#39;/action/&lt;EntityName&gt;/&lt;ActionName&gt;&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
</code></pre></div>

</div>
<h2 id="relations">Relations<a class="headerlink" href="#relations" title="Permanent link">Link</a></h2>
<div class="admonition example">
<p class="admonition-title">curl example</p>
<div class="highlight"><pre><span></span><code>curl <span class="s1">&#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;/&lt;RelationName&gt;?sort=&amp;page[number]=1&amp;page[size]=10&#39;</span>  -H <span class="s1">&#39;Authorization: Bearer &lt;Token&gt;&#39;</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">php example</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?php</span>
<span class="k">include</span><span class="p">(</span><span class="s1">&#39;vendor/rmccue/requests/library/Requests.php&#39;</span><span class="p">);</span>
<span class="nx">Requests</span><span class="o">::</span><span class="na">register_autoloader</span><span class="p">();</span>
<span class="nv">$headers</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
    <span class="s1">&#39;Authorization&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span>
<span class="p">);</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">python example</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">params</span> <span class="o">=</span> <span class="p">(</span>
    <span class="p">(</span><span class="s1">&#39;sort&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;page/[number/]&#39;</span><span class="p">,</span> <span class="s1">&#39;1&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;page/[size/]&#39;</span><span class="p">,</span> <span class="s1">&#39;10&#39;</span><span class="p">),</span>
<span class="p">)</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;http://localhost:6336/api/user_account/696c98d3-3b8b-41da-a510-08e6948cf661/marketplace_id&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">)</span>

<span class="c1">#NB. Original query string below. It seems impossible to parse and</span>
<span class="c1">#reproduce query strings 100% accurately so the one below is given</span>
<span class="c1">#in case the reproduced version is not &quot;correct&quot;.</span>
<span class="c1"># response = requests.get(&#39;http://localhost:6336/api/user_account/696c98d3-3b8b-41da-a510-08e6948cf661/marketplace_id?sort=&amp;page\[number\]=1&amp;page\[size\]=10&#39;, headers=headers)</span>
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">nodejs example</p>
<div class="highlight"><pre><span></span><code>var request = require(&#39;request&#39;);

var headers = {
    &#39;Authorization&#39;: &#39;Bearer &lt;Token&gt;&#39;
};

var options = {
    url: &#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;/&lt;RelationName&gt;?sort=&amp;page[number]=1&amp;page[size]=10&#39;,
    headers: headers
};

function callback(error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
</code></pre></div>

</div>
<div class="admonition example">
<p class="admonition-title">python example</p>
<div class="highlight"><pre><span></span><code><span class="kn">import</span> <span class="nn">requests</span>

<span class="n">headers</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;Authorization&#39;</span><span class="p">:</span> <span class="s1">&#39;Bearer &lt;Token&gt;&#39;</span><span class="p">,</span>
<span class="p">}</span>

<span class="n">params</span> <span class="o">=</span> <span class="p">(</span>
    <span class="p">(</span><span class="s1">&#39;sort&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;page[number]&#39;</span><span class="p">,</span> <span class="s1">&#39;1&#39;</span><span class="p">),</span>
    <span class="p">(</span><span class="s1">&#39;page[size]&#39;</span><span class="p">,</span> <span class="s1">&#39;10&#39;</span><span class="p">),</span>
<span class="p">)</span>

<span class="n">response</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;/api/&lt;EntityName&gt;/&lt;ReferenceId&gt;/&lt;RelationName&gt;&#39;</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="n">headers</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="n">params</span><span class="p">)</span>
</code></pre></div>

</div>
                
              
              
                


  <h2 id="__comments">Comments</h2>
  <div id="disqus_thread"></div>
  <script>var disqus_config=function(){this.page.url="https://daptin.github.io/daptin/apis/crud/",this.page.identifier="apis/crud/"};!function(){var e=document,i=e.createElement("script");i.src="//daptin-documentation.disqus.com/embed.js",i.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(i)}()</script>

              
            </article>
          </div>
        </div>
      </main>
      
        
<footer class="md-footer">
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-footer-copyright">
        
        Made with
        <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
          Material for MkDocs
        </a>
      </div>
      
    </div>
  </div>
</footer>
      
    </div>
    
      <script src="../../assets/javascripts/vendor.c3dc8c49.min.js"></script>
      <script src="../../assets/javascripts/bundle.f9edbbd5.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents"}</script>
      
      <script>
        app = initialize({
          base: "../..",
          features: [],
          search: Object.assign({
            worker: "../../assets/javascripts/worker/search.8e2cddea.min.js"
          }, typeof search !== "undefined" && search)
        })
      </script>
      
    
  </body>
</html>